#pragma once

#include "TdBulkConnection.h"
#include "TdColumn.h"
#include "TdUtils.h"

using namespace System::Collections::Generic;
using namespace System::Data::SqlClient;
using namespace System::Runtime::InteropServices;

namespace TdParallelTransportApi {

public ref class TdFastExport
{
public:
	TdFastExport(TdBulkConnection^ connection);

	void ReadFromServer(
		array<TdColumn^>^ sourceColumns,
		System::Action<array<System::Object^>^>^ rowReceived);

	property TdLogLevel LogLevel
	{
		TdLogLevel get();
		void set(TdLogLevel value);
	}

	property System::String^ SourceTableName
	{
		System::String^ get();
		void set(System::String^ value);
	}

	static const int MaxColumns = 256;
private:
	initonly TdBulkConnection^ m_Connection;
	System::String^ m_SourceTableName;
	//int m_BatchSize;
	TdLogLevel m_LogLevel;

	char* username;
	char* password;
	char* server;
	char* database;
	char* target;
	char* logLevel;
	char* select;

	void Initialize(array<TdColumn^>^ sourceColumns, int restartmode, void** conn_ptr, void** schema_ptr);
	void CleanUp();
};

}
